<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Gregwar\Captcha\CaptchaBuilder;

class RegisterController extends Controller
{
    
    public function regist()
    {
       return view("home.register");
    }

    
    public function doregist(Request $request)
    {
		//获取要添加的数据
		$userName = $request->input("userName");
		$password = $request->input("password");
		$password = md5($password);
		$question = $request->input("question");
		$answer = $request->input("answer");
        //执行添加
        \DB::table("user")->insert(['userName' => $userName,"password" => $password,"question"=>$question,"answer"=>$answer]);
        
        return view("home.login");
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
